package Leetcode.string;

public class FirstUniqChar {
    public int firstUniqChar(String s) {
        char[] ch=s.toCharArray();
        for(int i=0;i<ch.length;i++){
            for(int j=0;j<ch.length;j++){
                if(ch[i]==ch[j]&&i!=j)
                    break;
                else {
                    if (j == ch.length - 1)
                        return i;
                }
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        String str="coco";

        FirstUniqChar firstUniqChar=new FirstUniqChar();
        int a=firstUniqChar.firstUniqChar(str);
        System.out.println(a);

    }
}
